<template>
  <!-- 渲染一级路由 -->
  <RouterView />

  <!-- 底部Tabbar -->
  <Tabbar v-if="showTabbar" />
</template>

<script lang="ts" setup>
import { computed, onMounted } from "vue";
import { useRoute } from "vue-router";
import Tabbar from "@/components/tabbar.vue";
// import useStore from "@/hooks/useStore";
// import { showLoadingToast, closeToast, showConfirmDialog } from "vant";

// const { city } = useStore();
// 当前路由的信息对象
const route = useRoute();
// const router = useRouter();

// showTabbar
const showTabbar = computed(() => {
  // 要显示 Tabbar 组件的 路由Name 的集合
  const list = ["now-playing", "coming-soon", "cinema-list", "post", "center"];

  return list.includes(route.name as string);
});

onMounted(() => {
  // showLoadingToast("定位中...");
  // city
  //   .getLocation()
  //   .then((result) => {
  //     console.log("成功", result);
  //     closeToast();
  //     // 调用经纬度转换为城市数据的接口
  //     city.getLocae(result.longitude, result.latitude);
  //   })
  //   .catch((reason) => {
  //     console.log("失败", reason);
  //     closeToast();
  //     showConfirmDialog({
  //       message: "无法获取当前城市定位，请手动选择所在城市",
  //     }).then(() => {
  //       console.log("确认按钮点击");
  //       router.push({ name: "city" });
  //     });
  //   });
});
</script>

<style lang="scss">
@import "./global.scss";
</style>
